﻿@model List<Model.Commodity>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .clearfloat::after {
        content: '';
        display: block;
        clear: both;
    }

    .leftfloat {
        float: left;
    }

    .rightfloat {
        float: right;
    }

    .goodscontainer {
        padding-left: 30px;
        width: 1150px;
        height: 800px;
    }

    .snip1268 {
        font-family: 'Raleway', Arial, sans-serif;
        position: relative;
        overflow: hidden;
        margin: 10px;
        min-width: 220px;
        max-width: 260px;
        width: 90%;
        color: #333333;
        text-align: center;
        background-color: #ffffff;
        line-height: 1.6em;
    }

        .snip1268 * {
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            -webkit-transition: all 0.6s ease;
            transition: all 0.6s ease;
        }

        .snip1268 .image {
            position: relative;
        }

        .snip1268 img {
            max-width: 100%;
            vertical-align: top;
            -webkit-transition: opacity 0.35s;
            transition: opacity 0.35s;
        }

        .snip1268 .icons,
        .snip1268 .add-to-cart {
            position: absolute;
            left: 20px;
            right: 20px;
            opacity: 0;
        }

        .snip1268 .icons {
            -webkit-transform: translateY(-100%);
            transform: translateY(-100%);
            top: 20px;
            display: flex;
            justify-content: space-between;
        }

            .snip1268 .icons a {
                width: 32.5%;
                background: #ffffff;
            }

                .snip1268 .icons a:hover {
                    background: #000000;
                }

                    .snip1268 .icons a:hover i {
                        color: #ffffff;
                        opacity: 1;
                    }

            .snip1268 .icons i {
                line-height: 46px;
                font-size: 20px;
                color: #000000;
                text-align: center;
                opacity: 0.7;
                margin: 0;
            }

        .snip1268 .add-to-cart {
            position: absolute;
            bottom: 20px;
            -webkit-transform: translateY(100%);
            transform: translateY(100%);
            font-size: 0.8em;
            color: #000000;
            line-height: 46px;
            letter-spacing: 1.5px;
            background-color: #ffffff;
            font-weight: 700;
            text-decoration: none;
            text-transform: uppercase;
        }

            .snip1268 .add-to-cart:hover {
                background: #000000;
                color: #ffffff;
            }

        .snip1268 figcaption {
            padding: 20px 20px 30px;
        }

        .snip1268 h2,
        .snip1268 p {
            margin: 0;
            text-align: left;
        }

        .snip1268 h2 {
            margin-bottom: 10px;
            font-weight: 700;
        }

        .snip1268 p {
            margin-bottom: 15px;
            font-size: 0.85em;
            font-weight: 500;
        }

        .snip1268 .price {
            font-size: 1.3em;
            opacity: 0.5;
            font-weight: 700;
            text-align: right;
            display: inline;
        }

        .snip1268:hover img,
        .snip1268.hover img {
            opacity: 0.8;
        }

        .snip1268:hover .icons,
        .snip1268.hover .icons,
        .snip1268:hover .add-to-cart,
        .snip1268.hover .add-to-cart {
            -webkit-transform: translateY(0);
            transform: translateY(0);
            opacity: 1;
        }

</style>
<body class="">
    <div class="goodscontainer clearfloat">
        @{
            if (Model != null)
            {
                foreach (Model.Commodity it in Model)
                {
                    <figure class="snip1268  leftfloat">
                        <div class="image">
                            <iframe width="0px" height="0px" frameborder="0px" id="myiframe" name="myiframe"></iframe>
                            <img src=@it.Imgs alt=@it.Name />
                            @{
                                if (ViewBag.role == 2)
                                {
                                    <a href="\Order\AddToOrder?cid=@it.ID&num=1" class="add-to-cart" onclick="fun()" target="myiframe">加入购物车</a>
                                }
                            }
                        </div>
                        <figcaption>
                            <h2>@it.Name</h2>
                            <p>@it.Describe</p>

                            <div class="price">@it.Price 元 </div>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <a href="\Commodity\Index?cid=@it.ID" style="border:solid 3px;" target="_self">查看</a>
                        </figcaption>
                    </figure>
                }
            }
        }
    </div>
</body>
<script>
    /* Demo purposes only */
    $(".hover").mouseleave(
        function () {
            $(this).removeClass("hover");
        }
    );
    function fun() {
        alert("添加成功");
    }
</script>
</html>
